﻿<Window x:Class="_06.ResourceStyle.Style.EventSetter"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="EventSetter" Height="112" Width="339">
    <Window.Resources>
        <Style x:Key="style" TargetType="Control">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Foreground" Value="Blue"/>
            <Setter Property="BorderBrush" Value="Green"/>
            <!--note: put event in style is not recommended-->
            <EventSetter Event="Button.Click" Handler="OnButtonClicked"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <TextBox Grid.ColumnSpan="2" Name="tbxDisplay" 
                 Style="{StaticResource style}"/>
        <Button  Grid.Row="1" Grid.Column="0" Name="btnOK" Content="OK"
                 Style="{StaticResource style}"/>
        <Button  Grid.Row="1" Grid.Column="1" Name="btnCancel" Content="Cancel"
                 Style="{StaticResource style}"/>
    </Grid>
</Window>
